PATH
Hardware Documentation
> Device Managers and Drivers
> ATA Devices
> ATA Device Software Guide
|
ATA_ExecIO
You can use the ATA_ExecIO function to perform all data I/O transfers to or from an ATA
device. Your application must provide all of the parameters needed
to complete the transaction prior to calling the ATA Manager.
On return, the parameter block contains the result of the request.
A prior call to the ATA_SetDevConfig function is recommended to obtain the optimal performance from
the device. See ATA_SetDevConfig for information about the ATA_SetDevConfig function.
The manager function code for the ATA_ExecIO function is $01.
The parameter block associated with the ATA_ExecIO function is defined below:
typedef |
struct |
/* ATA_ExecIO structure */ |
{ |
|
|
|
|
ataPBHdr |
|
/* ataPBHdr parameter block */ |
|
SInt8 |
ataStatusReg; |
/* <-- Last device status */ |
|
|
|
/*register image */ |
|
SInt8 |
ataErrorReg; |
/* <-- Last device error register */ |
|
|
|
/*image (valid if bit 0 of */ |
|
|
|
/*Status field is set) */ |
|
SInt16 |
ataReserved; |
/* Reserved */ |
|
UInt32 |
BlindTxSize; |
/* --> Data transfer size */ |
|
UInt8* |
ioBuffer; |
/* --> Data buffer pointer */ |
|
UInt32 |
ioReqCount; |
/*<--> Number of bytes */ |
|
|
|
/* to transfer */ |
|
UInt32 |
ataActualTxCnt; |
/* <-- Number of bytes */ |
|
|
|
/*transferred */ |
|
UInt32 |
ataReserved2; |
/* Reserved */ |
|
devicePB |
RegBlock; |
/* --> Device register images */ |
|
ATAPICmdPacket |
*packetCDBPtr; |
/* --> ATAPI packet command */ |
|
|
|
/* block pointer */ |
|
UInt16 |
ataReserved3[6]; |
/* Reserved */ |
} ataExecIO; |
Field descriptions
-
ataPBHdr
-
See the definition of the ataPBHdr parameter block.
-
ataStatusReg
-
This field contains the last device status register image. See
the ATA-2 specification for status register bit definitions.
-
ataErrorReg
-
This field contains the last device error register image. This
field is valid only if the error bit (bit 0) of the Status register is set. See the ATA-2 specification for error register
bit definitions.
-
ataReserved
-
Reserved. All reserved fields are set to 0 for future compatibility.
-
BlindTxSize
-
This field specifies the maximum number of bytes that can be transferred
for each interrupt or detection of a data request. Bytes are transferred
in blind mode (no byte level handshake). Once an interrupt or
a data request condition is detected, the ATA Manager transfers
up to the number of bytes specified in the field from or to the
selected device. The typical number is 512 bytes.
-
The BlindTxSize field is used only for PIO transfers. It is ignored for DMA data
transfers.
-
This field is ignored for ATAPI commands. For the ATAPI ptotocol,
the dynamic byte transfer count is specified in the cylinder registers
(big-endian format) at the beginning of each interrupt. See the
Cylinders field in the definition of the devicePB structure for
the RegBlock field.
-
ioBuffer
-
This field contains either the host buffer address for the number
of bytes specified in the ioReqCount field and the requested transfer length, or a pointer to a scatter
gather list and the number of scatter gather entries. If the SGType bits of the ataFlags field are set, an IOBlk structure contains the scatter gather information. The IOBlk is defined as follows:
typedef |
struct |
|
{ |
|
|
|
|
UInt8* |
ioBuffer; |
/* --> Data buffer ptr */ |
|
UInt32 |
ioReqCount; |
/* --> Transfer length */ |
} IOBlk; |
-
ioBuffer
-
This field contains the host buffer address for the number of
bytes specified in the ioReqCount field. On returning, the ioBuffer field is updated to reflect data transfers. When the SGType bits of the ataFlags field are set, the ioBuffer field points to a scatter gather list. The scatter gather list
consists of a series of IOBlk entries.
-
ioReqCount
-
This field contains the number of bytes to transfer either from
or to the buffer specified in ioBuffer . On returning, the ioReqCount field is updated to reflect data transfers (0 if successful;
otherwise, the number of bytes that remained to be transferred
prior to the error condition). When the SGType bits of the ataFlags field are set, the ioReqCount field contains the number of scatter gather entries in the list
pointed to by the ioBuffer field.
-
ioReqCount
-
This field contains the number of bytes to transfer either from
or to the buffer specified in ioBuffer . On returning, this field is updated to reflect data transfers
(0 if successful; otherwise, the number of bytes that remained
to be transferred prior to the error condition). When the SGType bits of the ataFlags field are set, the ioReqCount field contains the number of scatter gather entries in the list
pointed to by the ioBuffer field.
-
ataActualTxCnt
-
This field contains the total number of bytes transferred for
this request.
-
ataReserved2
-
This field is reserved. To ensure future compatibility, all reserved
fields should be set to 0.
-
RegBlock
-
This field contains the ATA device register image structure. Values
contained in this structure are written out to the device during
the command delivery state. The caller must provide the image
prior to calling the ATA Manager. The ATA device register image
structure is defined as follows:
typedef |
struct |
/* Device register images */ |
{ |
|
UIntt8 |
Features; |
/* --> Features register */ |
|
UIntt8 |
Count; |
/* <--> Sector count */ |
|
|
|
/*image */ |
|
UIntt8 |
Sector; |
/* <--> Sector start/finish */ |
|
UIntt8 |
Reserved; |
/* Reserved */ |
|
UIntt16 |
Cylinder; |
/* <-->*/ Cylinder in big */
/* endian format */
|
|
UIntt8 |
SDH; |
/* <--> SDH register image */ |
|
UIntt8 |
Command; |
/* --> Command register image */ |
} devicePB; |
-
For ATAPI commands, the Cylinder image must contain the preferred
PIO DRQ packet size which is written out to the Cylinder High/Low
registers at command phase.
-
packetCDBPtr
-
This field contains the pointer to the ATAPICmdPtr packet structure for the ATAPI protocol. The ATAPI bit of the
ProtocolType field in the ataPBHdr must be set for this field to be valid.
Setting the ATAPI protocol bit also signals the ATA Manager to
initiate the transaction without the DRDY bit set in the status
register of the device. The ATAPICmdPtr structure is defined as
follows:
typedef |
struct |
/* ATAPI command packet */; |
{ |
|
SInt16 |
packetSize; |
/* Size of command in */
/* bytes (exclude size) */
|
|
SInt16 |
command[8]; |
/* The actual ATAPI */
/* command packet */
|
} ATAPICmdPacket; |
-
For ATA commands, this field should contain 0 in order to ensure
compatibility in the future.
-
ataReserved3[6]
-
These fields are reserved. To ensure future compatibility, all
reserved fields should be set to 0.
See Table A-1 for possible result codes returned by the ATA Manager.
© 1999 Apple Computer, Inc. — (Last Updated 30 Oct 97)
Previous | Back Up One Level | Next | Show Frames | Hide Frames